var gulp = require('gulp'),
    concat = require('gulp-concat'),
    uglify = require('gulp-uglify'),
    rename = require('gulp-rename'),
    del    = require('del'),
    minicss= require('gulp-minify-css');

gulp.task('js', function () {
    gulp.src([
        'scripts/jquery.js',
        'scripts/jqueryui.js',
        'scripts/owl.carousel.min.js',
        'scripts/jquery.swipebox.js',
        'scripts/snap.js',
        'scripts/custom.js',
        'scripts/framework.js',
        'scripts/framework.launcher.js',
    ])
        .pipe(concat('all.js'))
        .pipe(gulp.dest('scripts'))
        .pipe(uglify())
        .pipe(rename({suffix:'.min'}))
        .pipe(gulp.dest('scripts'));
});

gulp.task('css',function(){
    gulp.src('styles/*.css')
        .pipe(concat('all.css'))
        .pipe(gulp.dest('styles'))
        .pipe(minicss())
        .pipe(rename({suffix:'.min'}))
        .pipe(gulp.dest('styles'));
});

gulp.task('clean',function(){
    del([
        'styles/all.css',
        'styles/all.min.css',
        'scripts/all.js',
        'scripts/all.min.js'
    ]);
});

gulp.task('default',['clean','js','css']);